﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_DealTask]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_DealTask];
GO
CREATE PROCEDURE [dbo].[sproc_DealTask]
    @IDS as nvarchar(2000),
    @opt  as nvarchar(1),
    @username as nvarchar(30)
    --@date as nvarchar(40)
    
AS
DECLARE @SQL nvarchar(4000),@SQL2 nvarchar(4000)
    if @opt=2
    begin
        SET @SQL2 =  'UPDATE uds_Schedule SET IsConfirm='+@opt+' WHERE TaskID in (' + @IDS + ') '
        EXEC (@SQL2)
    end
    else
    begin
        SET @SQL = 'UPDATE uds_Schedule SET IsConfirm='+@opt+' WHERE TaskID in (' + @IDS + ') and Username='''+@username+"'"
        EXEC (@SQL)
    end